package ThreadDemo;

public class TreadDemo5 {
    public static void main(String[] args) throws InterruptedException {
        Thread thread=new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 1000; i++) {

                }
            }
        },"新线程");
        System.out.println("线程"+thread.getName()+"的状态是:"+thread.getState());
        Thread.sleep(500);
        thread.start();
        System.out.println("线程"+thread.getName()+"的状态是:"+thread.getState());
        Thread.sleep(1000);
        System.out.println("线程"+thread.getName()+"的状态是:"+thread.getState());
    }
}
